<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class Message implements ShouldBroadcast
{

    public $message;
    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($message)
    {
        //
        $this->message = $message;
    }

    /**
     * 向messages频道中发送消息
     * @return Channel|Channel[]|string|string[]
     *
     */
    public function broadcastOn()
    {
        // TODO: Implement broadcastOn() method.
        return new Channel("messages");
    }
}
